using System;
using System.Collections.Generic;
using System.Text;
using emp.Model.SysManage;
using emp.Utility;
using System.Web;
using emp.BLL.SysManage;

namespace emp.ProcessFlow.SysManage
{
    public class UserOrganizController
    {
        private const string URL_DEFAULT = "user_list.aspx";

        /// <summary>
        /// Default constructor
        /// </summary>
        public UserOrganizController()
        {
        }

        public bool Create(UserOrganizInfo newUserInfo, string sCurPage, string sMenuID)
        {

            try
            {
                // Creata a new business logic tier
                UserOrganiz myUserOrganiz = new UserOrganiz();

                // Call the insert method
                if (myUserOrganiz.Insert(newUserInfo) < 1)
                { 
                    return false;
                }

                //Finally forward to the welcome page
                HttpContext.Current.Response.Redirect(URL_DEFAULT + "?page=" + sCurPage + "&MenuID=" + sMenuID, true);

            }
            catch(Exception error)
            {

                string sMethod = "emp.ProcessFlow.UserOrganizController.Create(UserOrganizInfo newUserInfo,string sCurPage)";
                EventsLog.WriteLog(error, sMethod);
                return false;
            }

            return true;
        }
    }
}
